#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QHostAddress>
#include <QTcpSocket>
#include <QLabel>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT
private:
    enum State {
        kDisconnected,
        kConnected,
    };
public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void InitializeUi();
    void InitializeSignalSlot();
    void ConnectedCallback();
    void DisconnectedCallback();
    void Close();
    void SwitchState(State state);
private slots:
    void on_connect_btn_clicked();

    void on_send_msg_btn_clicked();

    void on_disconnect_btn_clicked();

private:
    Ui::MainWindow  *ui;
    QTcpSocket      *tcp_socket_;
    QLabel          *status_label_;
    State           state_;
};
#endif // MAINWINDOW_H
